package com.miyake.dsp.ui;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JComboBox;

public class DspComboBox extends DspSettingElement {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3585643901888102186L;
	JComboBox combo;
	public DspComboBox(String title, List<String> list) {
		this.setTitle(title);
		combo = new JComboBox();
		combo.setPreferredSize(new Dimension(80, WIDGET_HIGHT));
		for (String s : list) {
			combo.addItem(s);
		}
		this.add(combo);
		
		combo.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				fireChange((String)combo.getSelectedItem());
			}
		});
	}

	@Override
	protected Component getInputComponent() {
		return combo;
	}

	public void setSelected(String type) {
		combo.setSelectedItem(type);
	}
}
